package com.mazaiting.easy.base.presenter;

import com.mazaiting.easy.base.mvp.IBasePresenter;
import com.mazaiting.easy.base.mvp.IBaseView;


/**
 * 主持人基类
 *
 * @author mazaiting
 * @date 2018/2/5
 */
public class BasePresenter<T extends IBaseView> implements IBasePresenter<T> {
    /**
     * 页面
     */
    private T mView;

    /**
     * 获取当前 View
     * @return 布局
     */
    public T getView() {
        return mView;
    }

    /**
     * 绑定View
     */
    @Override
    public void attachView(T view) {
        if (null == view) {
            throw new NullPointerException("View is null, please load view.");
        }
        this.mView = view;
    }

    /**
     * 解除View的绑定
     */
    @Override
    public void detachView() {
        mView = null;
    }
}
